import request from '@/utils/request'

//分类
export const artGetChannelsService = async () => {
  const res = await request.get('/my/cate/list')
  return res
}

export const artAddChannelService = async (data: any) => {
  const res = await request.post('/my/cate/add', data)
  return res
}

export const artEditChannelService = async (data: any) => {
  const res = await request.put('/my/cate/info', data)
  return res
}

export const artDelChannelService = async (id: string) => {
  //query 参数  在params中传递
  const res = await request.delete('/my/cate/del', { params: { id } })
  return res
}

//文章
export const artGetListService = async (params: any) => {
  const res = await request.get('/my/article/list', { params: params })
  return res
}

//发布文章
export const artPublishService = async (data: any) => {
  const res = await request.post('/my/article/add', data)
  return res
}

//获取文章详情
export const artGetDetailService = async (id: string) => {
  const res = await request.get('/my/article/info', { params: { id } })
  return res
}

export const artEditService = async (data: any) => {
  const res = await request.put('/my/article/info', data)
  return res
}

export const artDelService = async (id: string) => {
  // /my/article/info
  const res = await request.delete('/my/article/info', { params: { id } })
  return res
}
